import request from "@/sheep/request";
import { data } from "uview-ui/libs/mixin/mixin";

export default {
  // 订单详情
  detail: (orderId) =>
    request({
      url: "/h5/order/orderDetail",
      params: orderId,
      method: "GET",
    }),
  // 发票详情
  invoice: (id) =>
    request({
      url: "order/invoice/" + id,
      method: "GET",
    }),
  // 获取支付结果
  payResult: (id) =>
    request({
      url: "order/order/" + id,
      method: "GET",
      custom: {
        showLoading: false,
      },
    }),
  itemDetail: (id, itemId) =>
    request({
      url: "order/order/itemDetail/" + id + "/" + itemId,
      method: "GET",
      custom: {
        showLoading: false,
      },
    }),
  // 订单列表
  list: (params) =>
    request({
      url: "/h5/order/page",
      method: "GET",
      params,
      custom: {
        showLoading: false,
      },
    }),
  // 计算订单信息
  calc: (data) =>
    request({
      url: "/h5/order/addOrderCheck",
      method: "POST",
      data,
    }),
  // 创建订单
  create: (data) =>
    request({
      url: "/h5/order/add",
      method: "POST",
      data,
    }),
  //订单可用优惠券
  coupons: (data) =>
    request({
      url: "order/order/coupons",
      method: "POST",
      data,
    }),
  // 确认收货
  confirm: (id) =>
    request({
      url: "/h5/order/orderComplete",
      params: { orderId: id },
      method: "GET",
    }),
  // 评价订单
  comment: (id, data) =>
    request({
      url: "order/order/comment/" + id,
      method: "POST",
      data,
    }),
  // 申请退款
  applyRefund: (data) =>
    request({
      url: "/h5/order/applyRefund",
      data,
      method: "POST",
    }),
  // 取消订单
  cancel: (data) =>
    request({
      url: "/h5/order/orderCancel",
      data,
      method: "POST",
    }),
  // 删除订单
  delete: (id) =>
    request({
      url: "order/order/" + id,
      method: "DELETE",
    }),
  // 售后
  aftersale: {
    // 申请售后
    apply: (data) =>
      request({
        url: "order/aftersale",
        method: "POST",
        data,
      }),
    list: (params) =>
      request({
        url: "order/aftersale",
        method: "GET",
        params,
        custom: {
          showLoading: false,
        },
      }),
    //取消售后
    cancel: (id) =>
      request({
        url: "/h5/order/cancelRefund",
        params: { orderId: id },
        method: "GET",
      }),
    //删除售后单
    delete: (id) =>
      request({
        url: "order/aftersale/" + id,
        method: "DELETE",
      }),
    // 售后详情
    detail: (id) =>
      request({
        url: "/h5/order/refundOrderDetail",
        method: "GET",
        params: { orderId: id },
      }),
    returnWaybillCode: (data) =>
      request({
        url: "h5/order/aftersale/delivery",
        data,
        method: "post",
        custom: {
          showLoading: true,
          showSuccess: true,
          successMsg: "提交成功",
        },
      }),
  },
  //订单包裹
  express: (id, orderId) =>
    request({
      url: "order/express/" + id + `${orderId ? "/" + orderId : ""}`,
      method: "GET",
    }),
  // 获取订单物流轨迹
  getOrderMaptrack: (params) =>
    request({
      url: "/h5/order/getOrderMaptrack",
      method: "GET",
      params,
      custom: {
        showLoading: false,
      },
    }),
  // 获取用户充值卡列表，/h5/getUserRechargeableCard
  getUserRechargeableCard: (params) =>
    request({
      url: "/h5/getUserRechargeableCard",
      method: "GET",
      params,
    }),
  // 钱包
  getUserBalanceRecord: (params) =>
    request({
      url: "/h5/getUserBalanceRecord",
      method: "GET",
      params,
    }),
  // 电影卡 蛋糕卡 商品
  getPayableCard: (params, data) =>
    request({
      url: "/h5/order/getPayableCard",
      method: "GET",
      params: params,
      data: data,
    }),
  //获取积分优惠策略 /h5/order/getIntegral
  getIntegral: () =>
    request({
      url: "/h5/order/getIntegral",
      method: "GET",
    }),
  //用户积分记录 /h5/getUserPointsRecord
  getUserPointsRecord: () =>
    request({
      url: "/h5/getUserPointsRecord",
      method: "GET",
    }),
  //用户兑换的商品册 /h5/getUserScoreBookRecord
  getUserScoreBookRecord: () =>
    request({
      url: "/h5/getUserScoreBookRecord",
      method: "GET",
    }),
  // 展示兑换完某商品册里面的商品
  getUserScoreBookProduct: (params) =>
    request({
      url: "/h5/getUserScoreBookProduct",
      method: "GET",
      params,
    }),
  // /h5/insertScoreBookProduct
  insertScoreBookProduct: (params) =>
    request({
      url: "/h5/insertScoreBookProduct",
      method: "GET",
      params,
    }),
  // 用户管理列表
  memberList: (params, data) =>
    request({
      url: "/admin/memberList",
      method: "POST",
      params: params,
      data: data,
    }),
  // 手机号扣款订单
  phoneOrder: (params, data) =>
    request({
      url: "/admin/phoneOrder",
      method: "POST",
      params: params,
      data: data,
    }),
  //查询商品信息列表
  productList: (params, data) =>
    request({
      url: "/admin/productList",
      method: "POST",
      params: params,
      data: data,
    }),
  //批量上下架商品
  operateProduct: (params, data) =>
    request({
      url: "/admin/operateProduct",
      method: "GET",
      params: params,
      data: data,
    }),
  //获取商品订单列表
  orderList: (params, data) =>
    request({
      url: "/admin/orderList",
      method: "POST",
      params: params,
      data: data,
    }),
  // 订单发货/admin/deliverProduct
  deliverProduct: (params, data) =>
    request({
      url: "/admin/deliverProduct",
      method: "POST",
      params: params,
      data: data,
    }),
  // 手机号扣款订单/admin/deliverProduct
  // 用户余额充值与扣款 /admin/operateBalance
  operateBalance: (params, data) =>
    request({
      url: "/admin/operateBalance",
      method: "GET",
      params: params,
      data: data,
    }),
  // /admin/order/aftersale/statistics 售后统计
  aftersaleStatistics: (params, data) =>
    request({
      url: "/admin/order/aftersale/statistics",
      method: "GET",
      params: params,
      data: data,
    }),

  // 获取运费信息
  getShipping: (params, data) =>
    request({
      url: "/no-auth/product/getShipping ",
      method: "GET",
      params: params,
      data: data,
    }),
  count: () =>
    request({
      url: "/h5/order/countOrder",
      method: "GET",
    }),
};
